nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound
TechnologiesCoding ProblemsBookmarksLearning Paths
nextRound

AI-powered interview preparation platform. Practice with curated questions, mock interviews, and personalized learning paths to crack your dream tech interview.

Quick Links

  • Technologies
  • Saved Questions
  • Pricing

Company

  • About Us
  • Contact Us

Legal

  • Privacy Policy
  • Terms of Use

© 2026 nextRound. All rights reserved.

TOPIC OVERVIEW

javascript/Concurrency and Threading

How a language with one thread still gets concurrent-feeling behavior.

10 QuestionsExpertHigh Priority ~14 min read

JavaScript executes on a single thread — only one line of your code runs at any instant. But 'single-threaded' doesn't mean the environment around it is. Browsers hand off networking, timers, and rendering to separate OS-level threads, and Node.js runs I/O through libuv's thread pool, so the parts of your program that feel 'concurrent' (a fetch resolving while a click handler fires) are actually the runtime coordinating work outside the JS thread and feeding results back through the event loop.

True parallel execution of your own JavaScript needs an explicit mechanism: Web Workers in the browser, worker_threads in Node. Each worker gets its own thread, its own memory, and its own event loop, and they don't share objects directly — they communicate by copying data through postMessage (or, for large binary data, transferring ownership via ArrayBuffer). That isolation is deliberate: it avoids the race conditions that come with shared-memory threading, at the cost of needing to serialize everything you send across.

What you'll walk away knowing

Why 'single-threaded' describes the JS engine, not the whole runtime environment
What Web Workers and worker_threads actually parallelize, and what they don't share by default
How postMessage and structured cloning work, and why passing large data has a real cost
The difference between concurrency (interleaved) and parallelism (simultaneous), and where each shows up in JS
1If JS is single-threaded, how does the GC not "freeze" my app?Intermediate
All Topics
1
Basics
Data Types
Functions
Objects
2
Engine
JIT
V8
Event Loop and Runtime
Concurrency and Threading
Bytecode and Parsing
Execution Context
Garbage Collector
3
this
Call Apply Bind
Closure
Error Handling
4
String Operations
Array Operations
Iterator and Generator
Modules
5
Events
Promises
Web Workers
Web Sockets
6
Functional Programming
Currying
Higher Order Functions
Memoisation
7
ES6 Classes
ES6
PWA
Web Assembly
Browser APIS
8
Security
Code
Polyfills
Sharethis topic

Share via WhatsApp, X, Facebook, LinkedIn or copy link. Open Graph preview enabled.